/**
 * @Author：ming
 * @Date：2023/10/2 9:39 PM
 * @Filename：Hj8
 */

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedList;

/**
 * @author ming
 */
public class Hj17 {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str ;
        while ((str=br.readLine())!=null){
            int x = 0;
            int y = 0;
            str = str.substring(0,str.length()-1);
            String[] split = str.split(";");
            for (int i = 0; i < split.length; i++) {
                if(isOk(split[i])){
                    int temp = Integer.valueOf(split[i].substring(1));
                    if(split[i].startsWith("A")){
                        x -= temp;
                    }else if(split[i].startsWith("D")){
                        x+=temp;
                    }else if(split[i].startsWith("W")){
                        y+=temp;
                    }else {
                        y-=temp;
                    }
                }
            }

            System.out.println(x+","+y);
        }
    }

    public static boolean isOk(String s){
        if(s.length()==0){
            return false;
        }

        char start = s.charAt(0);

        String s1 = s.substring(1);

        boolean flag = false;
        try {
            Integer i = Integer.valueOf(s1);
            if(i<100&&i>=0){
                flag = true;
            }

        }catch (Exception e){
            flag = false;
        }

        if(flag){
            if(start=='A'||start=='S'||start=='D'||start=='W'){
                return true;
            }
        }

        return false;
    }

}
